﻿using System;
using UnityEngine;

// Token: 0x0200038F RID: 911
public class UICharSelect : MonoBehaviour
{
	// Token: 0x060017CD RID: 6093 RVA: 0x00097342 File Offset: 0x00095542
	private void OnEnable()
	{
		this.menu = Camera.main.GetComponent<MenuController>();
		this.showChar();
	}

	// Token: 0x060017CE RID: 6094 RVA: 0x0009735A File Offset: 0x0009555A
	private void Start()
	{
		this.menu = Camera.main.GetComponent<MenuController>();
	}

	// Token: 0x060017CF RID: 6095 RVA: 0x00002973 File Offset: 0x00000B73
	private void Update()
	{
	}

	// Token: 0x060017D0 RID: 6096 RVA: 0x0009736C File Offset: 0x0009556C
	public void SwitchNextChar()
	{
		this.menu.switchNextChar();
		this.showChar();
	}

	// Token: 0x060017D1 RID: 6097 RVA: 0x0009737F File Offset: 0x0009557F
	public void SwitchPreviousChar()
	{
		this.menu.switchPreviousChar();
		this.showChar();
	}

	// Token: 0x060017D2 RID: 6098 RVA: 0x00097394 File Offset: 0x00095594
	public void showChar()
	{
		if (this.actualChar != null)
		{
			UnityEngine.Object.Destroy(this.actualChar);
		}
		GameObject activeChar = this.menu.getActiveChar();
		StateManager.instance.myData.name = activeChar.name;
		this.actualChar = UnityEngine.Object.Instantiate<GameObject>(activeChar, new Vector3(0f, 0.23f, -12f), Quaternion.identity);
	}

	// Token: 0x060017D3 RID: 6099 RVA: 0x00097403 File Offset: 0x00095603
	public void BackButton()
	{
		UnityEngine.Object.Destroy(this.actualChar);
		this.loadScene = string.Empty;
	}

	// Token: 0x060017D4 RID: 6100 RVA: 0x0009741C File Offset: 0x0009561C
	public void OkButton()
	{
		if (this.loadScene.Length > 1)
		{
			StateManager.instance.gameSettings.scene = this.loadScene;
			SavedScenesManager.Instance.LoadScene(this.loadScene);
		}
		else
		{
			UnityEngine.Object.Destroy(this.actualChar);
			this.loadScene = string.Empty;
		}
	}

	// Token: 0x04001A0B RID: 6667
	private MenuController menu;

	// Token: 0x04001A0C RID: 6668
	private GameObject actualChar;

	// Token: 0x04001A0D RID: 6669
	public Canvas uiStage;

	// Token: 0x04001A0E RID: 6670
	public Canvas menuUI;

	// Token: 0x04001A0F RID: 6671
	public string loadScene = string.Empty;
}
